# Maintainer:
# Contributor: Filipe Nascimento <flipee at tuta dot io>
# Contributor: Julien Nicoulaud <julien DOT nicoulaud AT gmail DOT com>

pkgname=python-cachelib
_name=${pkgname#python-}
pkgver=0.10.2
pkgrel=2
pkgdesc='A collection of cache libraries in the same API interface. Extracted from werkzeug'
arch=(any)
url='https://github.com/pallets/cachelib'
license=(BSD)
depends=(python)
makedepends=(python-build python-installer python-setuptools python-wheel)
checkdepends=(python-pytest-xprocess python-boto3)
source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.tar.gz")
sha256sums=('593faeee62a7c037d50fc835617a01b887503f972fb52b188ae7e50e9cb69740')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  PYTHONPATH="$PWD"/src \
  pytest -v -k 'not test_dynamodb_cache' # Fails on build.a.o
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -Dm644 LICENSE.rst -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
